package com.example.train_operate.controller;

import com.example.train_operate.dto.AddMeetingDTO;
import com.example.train_operate.dto.HistoryMeetingParamDTO;
import com.example.train_operate.dto.RoomDTO;
import com.example.train_operate.service.MeetingInfoService;
import com.example.train_operate.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.time.LocalDateTime;

@RestController
@CrossOrigin
@Api(tags = "通话房间信息管理接口")
@RequestMapping("/meetingInfo")
public class MeetingInfoController {

    @Resource
    private MeetingInfoService meetingInfoService;

//    /**
//     * 创建房间
//     * @param addMeetingDTO
//     * @return
//     */
//    @PostMapping("/addMeetingInfo")
//    @ApiOperation("创建房间")
//    public Result addMeetingInfo(@RequestBody AddMeetingDTO addMeetingDTO){
//        return meetingInfoService.addMeetingInfo(addMeetingDTO);
//    }

    /**
     * 创建房间
     * @return
     */
    @PostMapping("/addMeetingInfo")
    @ApiOperation("创建房间")
    public Result addMeetingInfo(){
        return meetingInfoService.addMeetingInfo();
    }

    /**
     * 结束房间
     * @param roomId
     * @return
     */
    @PostMapping("/finishMeeting")
    @ApiOperation("结束房间")
    public Result finishMeeting(@RequestParam Long roomId){
        return meetingInfoService.finishMeeting(roomId);
    }

    /**
     * 删除房间
     * @param roomId
     * @return
     */
    @PostMapping("/deleteMeeting")
    @ApiOperation("删除房间")
    public Result deleteMeeting(@RequestParam Long roomId){
        return meetingInfoService.deleteMeeting(roomId);
    }

    /**
     * 查询房间在线人数
     * @param roomId
     * @return
     */
    @PostMapping("/selectMeetingOnlineCount")
    @ApiOperation("查询房间在线人数")
    public Result selectMeetingOnlineCount(@RequestParam Long roomId){
        return meetingInfoService.selectMeetingOnlineCount(roomId);
    }

    /**
     * 查询房间在线成员信息
     * @param roomId
     * @return
     */
    @PostMapping("/selectOnlineInformation")
    @ApiOperation("查询房间在线成员信息")
    public Result selectOnlineInformation(@RequestParam Long roomId){
        return meetingInfoService.selectOnlineInformation(roomId);
    }

    /**
     * 查询历史房间列表
     * @return
     */
    @PostMapping("/selectHistoryMeetings")
    @ApiOperation("查询历史房间列表")
    public Result selectHistoryMeetings(@RequestBody HistoryMeetingParamDTO historyMeetingParamDTO){
        return meetingInfoService.selectHistoryMeetings(historyMeetingParamDTO);
    }


}
